package houseproject_commitytest;

import houseproject_commity.entity.Commity;
import houseproject_commity.mapper.CommityMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import java.util.List;

/**
 * Created by ws on 2019/6/23.
 */
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:springmvc.xml","classpath:spring/*.xml"})
public class testCommityMapper {
    @Autowired
    private CommityMapper commityMapper;
    @Test
    public void testfindbyid(){
        List<Commity> list=commityMapper.findByid(44);
        list.forEach(System.out::println);
    }
    @Test
    public void testsave(){
        Commity commity=new Commity();
        commity.setId(44);
        commity.setCommityid("111111");
        commity.setCommityname("幸福小区");
        commity.setAgentid("12");
        commity.setCommityaddress("苏州市工业园区服务外包");
        commity.setSellnumber("5");
        commityMapper.save(commity);
    }
    @Test
    public void testdel(){
        commityMapper.del(43);
        System.out.println("删除成功");
    }

  }
